package com.twu.biblioteca;

import com.sun.xml.internal.ws.server.sei.SEIInvokerTube;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by pchavez on 07/02/14.
 */
public class UserManager {
    private List<User> users = new ArrayList<User>();
    private User currentUser;

    public void addUser(User user) {
        users.add(user);
    }

    public boolean logIn(String userID, String password){
        for (User user : users){
            if (user.isValid(userID, password)){
                currentUser = user;
                return true;
            }
        }
        return false;
    }

    public User getCurrentUser() {
        return currentUser;
    }
}
